<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增客户拜访')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-visit-add">
        	<input name="customerId" type="hidden" id="customerId" />
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所属客户：</label>
                <div class="col-sm-8">
                	<div class="input-group">
	                    <input name="customerName" onclick="selectCustomer()" id="customerName" type="text" placeholder="请选择所属客户 " class="form-control" required readonly>
	                	<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="visitDate" class="form-control" placeholder="yyyy-mm-dd HH:mm" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访人姓名：</label>
                <div class="col-sm-8">
                    <input name="visitName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访人电话：</label>
                <div class="col-sm-8">
                    <input name="visitPhone" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">拜访内容：</label>
                <div class="col-sm-8">
                    <textarea name="visitContent" class="form-control" required></textarea>
                </div>
            </div>            
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">拜访状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('visit_Status')}">
                        <input type="radio" th:id="${'visitStatus_' + dict.dictCode}" name="visitStatus" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'visitStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "crm/visit"
        $("#form-visit-add").validate({
        	onkeyup: false,
        	rules:{
        		visitName:{
        			isName:true
        		},
        		visitPhone:{
        			isPhone:true
        		}
        	},
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-visit-add').serialize());
            }
        }

        $("input[name='visitDate']").datetimepicker({
        });
        
        /* 拜访管理-新增-选择客户 */
        function selectCustomer() {
        	 var url = ctx + "crm/customer/selectCustomer";
        	 /* var options = {
				title: '选择客户',
				width: "780",
				url: url
			};
			$.modal.openOptions(options);
        	*/
        	 $.modal.open("选择客户", url);
		}
    </script>
</body>
</html>